<?php
namespace app\common\controller;
use think\helper\Str;
use helper\Wechat;
/**
 * 
 */
class Config extends Base
{
    public static function appDefaultConfig()
    {
        $Data=[
            'appName'               =>  config('web.name'),
            'desc'                  =>  config('xy_seo.description'),
            'logo'                  =>  config('web.imgurl').config('web.icon'),
            'shareUrl'              =>  config('web.h5'),
            'wxpayStatus'           =>  config('wxpay.status'),
            'alipayStatus'          =>  config('alipay.status'),
            'downUrl'               =>  config('web.downUrl'),
            'webtel'           	    =>  config('web.tel'),
            'message_address'       =>  config('xycms_message.im_address'),
            'jobs_salary_show_type' =>  config('xy_company.jobs_salary_show_type'),
            'IMKEY'                 =>  config('xy_xycms.key'),
            'applepay_product_id'   =>  config('applepay.product_id'),           
            'h5_map_key'            =>  config('xy_map.js_key'),           
            'mp_map_key'            =>  config('xy_map.wechat_key'),           
            'AppStoreUrl'           =>  config('xy_app_config.app_store_url'),
            'is_forceattestation'   =>  config('xy_company.is_forceattestation'),
            'applepayStatus'        =>  config('applepay.status'),
            'xy_score'              =>  [
                'recharge_rate' =>  config('xy_score.recharge_rate'),
                'is_integer'    =>  config('xy_score.is_integer'),
                'proportion'    =>  config('xy_score.proportion'),
            ]
        ];
        if (!empty(request()->AppInfo['app_modul'])&&request()->AppInfo['app_modul']=='mobile'&&request()->is_wx) {
            try {
                $tinket=Wechat::getTicket();
                if ($tinket) {
                    $url=config('web.h5').'/';
                    $wxShareData=[
                        'noncestr'=>Str::random(16),
                        'jsapi_ticket'=>$tinket,
                        'timestamp'=>time(),
                        'url'=>$url
                    ];
                    ksort($wxShareData);
                    $wxShareData['signature']=sha1(urldecode(http_build_query($wxShareData)));
                    $wxShareData['appid']=config('xy_wechat_mp.appid').'';
                    unset($wxShareData['jsapi_ticket']);
                    $Data['wxShareData']=$wxShareData;
                }
            } catch (\think\Exception $e) {
                
            }
        }
        return $Data;
    }
}